import React, { useState } from 'react'
import Button from './1-Button';
import Image from './1-Image';
export default function SwitchImage() {
  //声明一个状态
  let [image, setImage] = useState("http://api.xiaohigh.com/image/random");

  //声明一个函数
  let change = () => {
    setImage("http://api.xiaohigh.com/image/random?_t=" + Date.now());
  }
  return (
    <div>
      <Button change={change}></Button>
      <hr />
      <Image image={image} />
    </div>
  )
}
